package com.example.coupon.controller;

import com.example.coupon.controller.vo.ActivityVO;
import com.example.coupon.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ActivityController {

    @Autowired
    private ActivityService activityService;

    @RequestMapping("/addActivity")
    public String addActivity(@RequestBody ActivityVO activityVO) {
        try {
            return activityService.addActivity(activityVO);
        } catch (Exception e) {
            return "创建活动失败";
        }
    }

    @RequestMapping("/signUpActivity")
    public String signUpActivity(@RequestParam Long merchantId, @RequestParam Long activityId){
        return activityService.signUpActivity(merchantId, activityId);
    }

}